﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using mylib;
using System.Text;

public partial class Contact : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack && !Request.IsLocal)
        {
            SendEmail();
        }
    }


    /// <summary>
    /// 
    /// </summary>
    private void SendEmail()
    {

        StringBuilder str = new StringBuilder();
        str.AppendFormat("From:{0} <br/>{1}",txtEmail.Text,txtBody.Value);
        mylib.Utils.Mail m = new mylib.Utils.Mail();
        if(m.SendMail(txtSubject.Text, str.ToString(),"alexey@rahlin.info","website@rahlin.info" ))
        {
            divMsg.Visible = true;
        }
        else
        {
            hMsg.InnerText = "Error occured";
        }
    }
}